<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>

<html xmlns="http://www.w3.org/1999/xhtml">

	<head>

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

		<title><?php echo C('WEB_TITLE');?></title>

		<link rel="stylesheet" type="text/css" href="/Public/css/common.css"/>

		<link rel="stylesheet" type="text/css" href="/Public/js/layui/css/layui.css" media="all"/>

		<link rel="stylesheet" href="/Public/js/datepicker/datepicker.css"/>

		<link rel="stylesheet" type="text/css" href="/Public/crm/css/index.css"/>

		<link rel="stylesheet" type="text/css" href="/Public/crm/css/style.css"/>

		<link rel="stylesheet" href="<?php echo C('PC_ICON_HTTP');?>">

		<script type="text/javascript" >

			const moduleName = "<?php echo (MODULE_NAME); ?>";

		</script>

        <link rel="stylesheet" href="/Public/js/viewer/css/viewer.min.css">
		
		<link rel="stylesheet" type="text/css" href="/Public/js/select2/select2.css" media="all"/>

		<script type="text/javascript" src="/Public/js/jquery-1.9.1.min.js"></script>
		
		<script type="text/javascript" src="/Public/js/jquery-ui.min.js"></script>

		<script type="text/javascript" src="/Public/js/cookie/jquery.cookie.js"></script>

		<script type="text/javascript" src="/Public/js/lang/<?php echo (getStrToLower(cookie('think_language'))); ?>.js"></script>

		<script type="text/javascript" src="/Public/js/colorpicker.js"></script>

		<script type="text/javascript" src="/Public/js/layer/layer.js"></script>

		<script type="text/javascript" src="/Public/js/layui/layui.js"></script>

        <script type="text/javascript" src="/Public/js/feeldesk.js"></script>

        <script type="text/javascript" src="/Public/crm/js/index.js"></script>

        <script type="text/javascript" src="/Public/js/jquery.nicescroll.js"></script>

		<script type="text/javascript" src="/Public/js/clipboard.min.js"></script>

		<script type="text/javascript" src="/Public/js/select2/select2.min.js"></script>

		<script type="text/javascript" src="/Public/js/select2/jquery.core.js"></script>

	</head>

<body>

<script type="text/javascript" src="/Public/js/datepicker/datepicker.all.js"></script>

<script type="text/javascript" src="/Public/js/datepicker/moment.min.js"></script>

<script type="text/javascript" src="/Public/js/datepicker/datepicker.en.js"></script>

    <div class="fd-right-main">

        

    <div class="feeldesk-form pd0">

		<form action="" class="layui-form" method="post" enctype="multipart/form-data">

		<div class="layui-tab">

            <ul class="layui-tab-title">

                <li class="layui-this"><?php echo L('ADD_CUSTOMER');?></li>

				<div class="form-submit">

					<a href="javascript:" class="layui-btn layui-btn-normal submitForm"><?php echo l('SUBMIT');?></a>

					<?php if(!empty($wechat)): ?><a href="javascript:closeLayerOpen();" class="layui-btn layui-btn-normal titleCancel"><?php echo l('CANCEL');?></a>

					<div class="clear"></div><?php endif; ?>

				</div>

            </ul>

        </div>

        <!--<div class="form-nav">

            <ul>

                <li><a href="javascript:" onclick="switchtab(this,1);" class="form-tab active"><?php echo L('BASIC_INFORMATION');?></a></li>

                <li><a href="javascript:" onclick="switchtab(this,2);" class="form-tab"><?php echo L('PRIMARY_CONTACT');?></a></li>

            </ul>

        </div>-->
		<?php $t = 0; $ft = 0; $reg = 0; ?>
        <div class="form-content form-content1 wd100 fl">

                <div class="form-item pb25 pt50">

					<div class="layui-form-item">

						<label class="layui-form-label">

						   <?php echo L('CUSTOMER_RESPONSIBLE');?>

						</label>

						<div class="layui-input-inline">

							<select name="customer[member_id]" lay-ignore id="select2">

								<option value=""><?php echo L('CHOOSE'); echo L('CUSTOMER_RESPONSIBLE');?></option>

								<?php if(is_array($members)): $i = 0; $__LIST__ = $members;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><option value="<?php echo ($v["member_id"]); ?>" <?php if(empty($type)): if(($thisMember["member_id"]) == $v["member_id"]): ?>selected<?php endif; endif; ?>><?php echo ($v["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>

							</select>

							<script>

								$("#select2").select2();

							</script>

						</div>

						<i class="layui-icon layui-icon-about intro-icon" data-note="<?php echo L('ENTER_NAME_SEARCH');?>"></i>

					</div>

                    <input type="hidden" name="customer[from_type]" value="<?php echo ($fromType); ?>"/>

                    <input type="hidden" name="customer[originalId]" value="<?php echo ($apiData["originalId"]); ?>"/>

					<?php if($crmsite['customerReseller'] == 1): ?><div class="layui-form-item">

							<label class="layui-form-label">

								<span class="red">*</span>

							   <?php echo L('CUSTOMER_TYPE');?>

							</label>

							<div class="layui-input-inline">

								<input type="radio" name="customer[customer_type]" value="customer" checked title="<?php echo L('ORDINARY_CUSTOMER');?>">

								<input type="radio" name="customer[customer_type]" value="agent" title="<?php echo L('DEALER');?>">

							</div>

						</div><?php endif; ?>

                       <?php if(is_array($customerform)): $i = 0; $__LIST__ = $customerform;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><!-- 字段未设置查看范围或当前用户角色在查看范围内 -->
                       <?php if(!$vo['role_id'] || in_array($index['role_id'],explode(',',$vo['role_id']))): ?><div class="layui-form-item">

                            <label class="layui-form-label">

                                <?php if(($vo["is_required"]) == "0"): ?><span class="red">*</span><?php endif; ?>

                                <?php echo ($vo["form_description"]); ?>

                            </label>

							<?php if(($vo["form_type"]) == "region"): $reg++; ?>


								<?php echo W('Region/getRegion',['customer_form',$vo['form_name'],$reg]);?>

							<?php else: ?>

                            <div class="layui-input-inline">

                                <?php if(($vo["form_type"]) == "text"): ?><!-- 单行文本框 -->
                                    <input type="text" name="customer_form[<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($customerData[$vo['form_name']]); ?>" placeholder="" class="layui-input"><?php endif; ?>

								 <?php if(($vo["form_type"]) == "phone"): ?><!-- <?php echo L('CELL_PHONE');?> -->
                                    <input type="text" onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && event.keyCode<48 || event.keyCode>57) event.returnValue=false" name="customer_form[<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($customerData[$vo['form_name']]); ?>" placeholder="" class="layui-input"><?php endif; ?>

								 <?php if(($vo["form_type"]) == "email"): ?><!-- <?php echo L('MAILBOX');?> -->
                                    <input type="text" name="customer_form[<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($customerData[$vo['form_name']]); ?>" placeholder="" class="layui-input"><?php endif; ?>

								 <?php if(($vo["form_type"]) == "number"): ?><!-- <?php echo L('DIGITAL');?> -->
                                    <input type="number" onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && event.keyCode<48 || event.keyCode>57) event.returnValue=false" name="customer_form[<?php echo ($vo["form_name"]); ?>]" placeholder="" class="layui-input"><?php endif; ?>

								<?php if(($vo["form_type"]) == "decimal"): ?><!-- 小数 -->
                                    <input type="text" name="customer_form[<?php echo ($vo["form_name"]); ?>]" placeholder="" class="layui-input"><?php endif; ?>

                                <?php if(($vo["form_type"]) == "select"): ?><!-- 下拉菜单 -->
                                    <select name="customer_form[<?php echo ($vo["form_name"]); ?>]">

                                        <option value=""><?php echo ($vo["form_description"]); ?></option>

                                        <?php if(is_array($vo["option"])): foreach($vo["option"] as $key=>$op): ?><option value="<?php echo ($op); ?>"><?php echo ($op); ?></option><?php endforeach; endif; ?>

                                    </select><?php endif; ?>

                                <?php if(($vo["form_type"]) == "select_text"): $st++; ?>
                                    <!-- 下拉填写 -->
                                    <?php echo W('Update/selectTextForm',['customer',$vo,$st]); endif; ?>

                                <!-- 时间控件 -->
                                <?php if(($vo["form_type"]) == "date"): $ft++; ?>

                                    <input type='text' name="customer_form[<?php echo ($vo["form_name"]); ?>]" class="layui-input cursor layui-form-time" id="form_time<?php echo $ft; ?>" placeholder="<?php echo L('SELECT_TIME');?>" ><?php endif; ?>


                                <?php if(($vo["form_type"]) == "checkbox"): ?><!-- 复选框 -->
                                    <?php if(is_array($vo["option"])): $i = 0; $__LIST__ = $vo["option"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$op): $mod = ($i % 2 );++$i;?><input type="checkbox" name="customer_form[<?php echo ($vo["form_name"]); ?>][]" lay-skin="primary" title="<?php echo ($op); ?>" value="<?php echo ($op); ?>"><?php endforeach; endif; else: echo "" ;endif; endif; ?>

                                <?php if(($vo["form_type"]) == "radio"): ?><!-- 单选框-->
                                    <?php if(is_array($vo["option"])): $i = 0; $__LIST__ = $vo["option"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$op): $mod = ($i % 2 );++$i;?><input type="radio" name="customer_form[<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($op); ?>" title="<?php echo ($op); ?>"><?php endforeach; endif; else: echo "" ;endif; endif; ?>

                                <!-- 文本域 -->
                                <?php if(($vo["form_type"]) == "textarea"): $t++ ?>

                                    <textarea class="layui-textarea layui-hide ticket-textarea" name="customer_form[<?php echo ($vo["form_name"]); ?>]" id="ticketEditor<?php echo $t; ?>"></textarea><?php endif; ?>

                            </div><?php endif; ?>

                            <?php if(!empty($vo["form_explain"])): ?><i class="layui-icon layui-icon-about intro-icon" data-note="<?php echo ($vo["form_explain"]); ?>"></i><?php endif; ?>

                        </div><?php endif; endforeach; endif; else: echo "" ;endif; ?>

				</div>

        </div>

		<div class="form-content form-content2 wd50 fr hidden">

			<div class="form-item pt50 pb25 create-both-end">

                   <?php if(is_array($contacterform)): $i = 0; $__LIST__ = $contacterform;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><!-- 字段未设置查看范围或当前用户角色在查看范围内 -->
                   <?php if(!$vo['role_id'] || in_array($index['role_id'],explode(',',$vo['role_id']))): ?><div class="layui-form-item">

                            <label class="layui-form-label">

                                <?php if(($vo["is_required"]) == "0"): ?><span class="red">*</span><?php endif; ?>

                                <?php echo ($vo["form_description"]); ?>

                            </label>

							<?php if(($vo["form_type"]) == "region"): $reg++; ?>

								<?php echo W('Region/getRegion',['contacter_form',$vo['form_name'],$reg]);?>

							<?php else: ?>

                            <div class="layui-input-inline">

                                <?php if(($vo["form_type"]) == "text"): ?><!-- 单行文本框 -->
									<?php if(($vo["form_name"]) == "wechat"): if(!empty($wechat)): ?><input type="text" name="contacter_form[<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($wechat); ?>" readonly placeholder="" class="layui-input">

										<?php else: ?>

											<input type="text" name="contacter_form[<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($contacterData[$vo['form_name']]); ?>" placeholder="" class="layui-input"><?php endif; ?>

									<?php else: ?>

										<input type="text" name="contacter_form[<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($contacterData[$vo['form_name']]); ?>" placeholder="" class="layui-input"><?php endif; endif; ?>

								 <?php if(($vo["form_type"]) == "phone"): ?><!-- <?php echo L('CELL_PHONE');?> -->
                                    <input type="text" onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && event.keyCode<48 || event.keyCode>57) event.returnValue=false" name="contacter_form[<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($contacterData[$vo['form_name']]); ?>" placeholder="" class="layui-input"><?php endif; ?>

								 <?php if(($vo["form_type"]) == "email"): ?><!-- <?php echo L('MAILBOX');?> -->
                                    <input type="text" name="contacter_form[<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($contacterData[$vo['form_name']]); ?>" placeholder="" class="layui-input"><?php endif; ?>

								 <?php if(($vo["form_type"]) == "number"): ?><!-- <?php echo L('DIGITAL');?> -->
                                    <input type="number" onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && event.keyCode<48 || event.keyCode>57) event.returnValue=false" name="contacter_form[<?php echo ($vo["form_name"]); ?>]" placeholder="" class="layui-input"><?php endif; ?>

								<?php if(($vo["form_type"]) == "decimal"): ?><!-- 小数 -->
                                    <input type="text" name="contacter_form[<?php echo ($vo["form_name"]); ?>]" placeholder="" class="layui-input"><?php endif; ?>

                                <?php if(($vo["form_type"]) == "select"): ?><!-- 下拉菜单 -->
                                    <select name="contacter_form[<?php echo ($vo["form_name"]); ?>]">

                                        <option value=""><?php echo ($vo["form_description"]); ?></option>

                                        <?php if(is_array($vo["option"])): foreach($vo["option"] as $key=>$op): ?><option value="<?php echo ($op); ?>"><?php echo ($op); ?></option><?php endforeach; endif; ?>

                                    </select><?php endif; ?>
								
								<?php if(($vo["form_type"]) == "select_text"): $st++; ?>
                                    <!-- 下拉填写 -->
                                    <?php echo W('Update/selectTextForm',['contacter',$vo,$st]); endif; ?>

                                <!-- 时间控件 -->
                                <?php if(($vo["form_type"]) == "date"): $ft++; ?>

                                    <input type='text' name="contacter_form[<?php echo ($vo["form_name"]); ?>]" class="layui-input cursor layui-form-time" id="form_time<?php echo $ft; ?>" placeholder="<?php echo L('SELECT_TIME');?>" ><?php endif; ?>

                                <?php if(($vo["form_type"]) == "checkbox"): ?><!-- 复选框 -->
                                    <?php if(is_array($vo["option"])): $i = 0; $__LIST__ = $vo["option"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$op): $mod = ($i % 2 );++$i;?><input type="checkbox" name="contacter_form[<?php echo ($vo["form_name"]); ?>][]" lay-skin="primary" title="<?php echo ($op); ?>" value="<?php echo ($op); ?>"><?php endforeach; endif; else: echo "" ;endif; endif; ?>

                                <?php if(($vo["form_type"]) == "radio"): ?><!-- 单选框-->
                                    <?php if(is_array($vo["option"])): $i = 0; $__LIST__ = $vo["option"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$op): $mod = ($i % 2 );++$i;?><input type="radio" name="contacter_form[<?php echo ($vo["form_name"]); ?>]" value="<?php echo ($op); ?>" title="<?php echo ($op); ?>"><?php endforeach; endif; else: echo "" ;endif; endif; ?>

                                <!-- 文本域 -->
                                <?php if(($vo["form_type"]) == "textarea"): $t++ ?>

                                    <textarea class="layui-textarea layui-hide ticket-textarea" name="contacter_form[<?php echo ($vo["form_name"]); ?>]" id="ticketEditor<?php echo $t; ?>"></textarea><?php endif; ?>

                            </div><?php endif; ?>

                            <?php if(!empty($vo["form_explain"])): ?><i class="layui-icon layui-icon-about intro-icon" data-note="<?php echo ($vo["form_explain"]); ?>"></i><?php endif; ?>

                        </div><?php endif; endforeach; endif; else: echo "" ;endif; ?>

				</div>

		</div>

		<div class="clear"></div>

		</form>

    </div>

    <script type="text/javascript" src="/Public/js/submitform.js"></script>
<script type="text/javascript">
	
	layui.use('form',function()
	{
		var form = layui.form;
		
		form.render('checkbox');
		
		form.render('radio');
		
		form.render('select');

	})
	
</script>



    <script type="text/javascript">

        $("#choose").hide();

        layui.use('form',function()
        {
            var form = layui.form;

            form.on('select(form_type)', function(data)
            {
                var type = data.value;

                if(type == 'radio' || type == 'checkbox' || type == 'select')
                {
                    $("#choose").slideDown(300);
                }
                else
                {
                    $("#choose").slideUp(300);
                }
            });
        })

    </script>



    </div>

    <script type="text/javascript">

        layer.ready(function()
        {
            layer.photos({
                photos: '.textareaImg',
                shift: 5,
                shade: [0.8, 'rgba(0,0,0,.8)']
            });

        })

    </script>

    <script>

        //客户端
        /*if ( navigator.userAgent.toLowerCase().indexOf('electron/') > -1)
        {
            top.setIframe(document);
        }*/
    </script>

    </body>

</html>